package tomoto.assertion;

/**
 * Utility to augment Java assertion.
 * 
 * @author Tomoto Shimizu Washio
 * 
 */
public class AssertUtil {
	@Deprecated
	private AssertUtil() {}

	/**
	 * Throws {@link AssertionError}. This function is declared to return an
	 * exception so that you can write throws statement like the following
	 * example to avoid compile errors related to unreachable code.
	 * 
	 * <pre>
	 *   switch (data) {
	 *   case 0:
	 *     ...
	 *     return ...;
	 *   case 1:
	 *     ...
	 *     return ...;
	 *   ...
	 *   default:
	 *     <b>throw</b> AssertUtil.fail(); // seems to be a bug
	 *   }
	 *   // compiler now knows this code is never reached here.
	 * </pre>
	 * 
	 * @return This function never returns but always throws an exception.
	 * @throws AssertionError thrown always
	 */
	public static AssertionError fail() {
		throw new AssertionError();
	}
}
